package com.qlm.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.qlm.interceptor.AuthInterceptor;
import com.qlm.service.IAwardService;
import com.qlm.service.impl.ArwardServiceImpl;
import com.qlm.view.ArwardView;

@Before(AuthInterceptor.class)
public class AwardManageController extends Controller{
	
	protected final static Logger       logger = LoggerFactory.getLogger(AwardManageController.class); 

	private IAwardService awardService  = enhance(ArwardServiceImpl.class);
	/**
	 * 兑奖申请
	 */
	public void djApply() {
		  String aoData = getPara("aoData");
		  if(aoData == null){
			  render("/page/djApply.jsp");
			  return;
		  }else{
			 String  jsonStr = awardService.djApply(aoData);
			  renderJson(jsonStr);
		  }		
	}
	
	/**
	 * 兑奖记录
	 */
	public void djRecord() {
		  String aoData = getPara("aoData");
		  if(aoData == null){
			  render("/page/djRecord.jsp");
			  return;
		  }else{
				 String  jsonStr = awardService.djRecord(aoData);
				  renderJson(jsonStr);
		  }		
	}	
	
	/**
	 * 兑奖申请审核（发货）
	 */
	public void addLogisticsInformation(){
		String logisticsName = getPara("logisticsName");
		String logisticsNum = getPara("logisticsNum");
		Integer id = getParaToInt("id");
		awardService.addLogisticsInformation(logisticsName,logisticsNum,id);
		redirect("/awardManage/djApply");
	}

	/**
	 * 红包兑奖记录
	 */
	public void hbDhRecord() {
		  String aoData = getPara("aoData");
		  if(aoData == null){
			  render("/page/hbDhRecord.jsp");
			  return;
		  }else{
				 String  jsonStr = awardService.hbDhRecord(aoData);
				  renderJson(jsonStr);
		  }		
	}
}
